package com.action.sboard;

import java.util.ArrayList;
import java.util.List;

import com.action.*;
import com.db.sboard.BoardTypeVO;
import com.db.sboard.BoardVO;
import com.db.sboard.boardDAO;

public class MainAction {
	private int no;
	private String main_jsp;

	private List<BoardVO> list = new ArrayList<BoardVO>();
	private List<BoardTypeVO> btlistC = new ArrayList<BoardTypeVO>();
	private List<BoardTypeVO> btlistD = new ArrayList<BoardTypeVO>();
	private boardDAO sbDAO;

	public void setSbDAO(boardDAO sbDAO) {
		this.sbDAO = sbDAO;
	}

	public List<BoardVO> getList() {
		return list;
	}
	public List<BoardTypeVO> getBtlistC() {
		return btlistC;
	}
	public List<BoardTypeVO> getBtlistD() {
		return btlistD;
	}

	public String getMain_jsp() {
		return main_jsp;
	}
	public void setNo(int no) {
		this.no = no;
	}

	public String execute() throws Exception {
		list = sbDAO.empAll();
		List<BoardTypeVO> btlist = sbDAO.getBoardTypeList();
		for(BoardTypeVO btvo : btlist){
			if(btvo.getDeptno() == 0){
				btlistC.add(btvo);
			}else{
				btlistD.add(btvo);
			}
		}		
		// 0:main1, 1:board, 2:content, 3:sub, 4:update
		main_jsp = change.jspchange(no);
		return "success";
	}

}
